package com.robertbruce.astar;

import java.util.Collection;

public interface Node <T extends Node<T>>  //Extends Node<T> to ensure that we only navigate nodes
{

	/**
	 * returns the estimated cost to reach the goal.  This needs to be less than or equal to
	 * the actual end cost to the goal or it can use a liner function  (such as Manhattan distance)
	 * so long as all nodes use the same linear function.  Over estimating will cause incorrect results.
	 * 
	 * when in doubt use 0.
	 * 
	 * @param theTarget - the node we are trying to traverse to
	 * 
	 * @return the estimate cost as a double
	 */
	double calculateEstimatedCost(T theTarget);
	
	/**
	 * This returns the actual cost of getting from a node to the given neighbor.
	 * @param theNeighbor the neighbor we are pathing through.
	 * @return the cost to the neighbor
	 */
	double calculateTheTraverseCost(T theNeighbor);
	
	/**
	 * returns the collection of neighbors associated with this node.
	 * @return the collection of neighbors
	 */
	Collection<T> getNeighbors();
}
